<lib:EditControl x:Class="MoPlus.SolutionBuilder.WpfClient.UserControls.Models.PropertyItemControl"
                     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                     xmlns:VM="clr-namespace:MoPlus.ViewModel;assembly=MoPlus.ViewModel"
                     xmlns:ModelsVM="clr-namespace:MoPlus.ViewModel.Models;assembly=MoPlus.ViewModel"
                     xmlns:lib="clr-namespace:MoPlus.SolutionBuilder.WpfClient.Library"
                     xmlns:Settings="clr-namespace:MoPlus.SolutionBuilder.WpfClient.Library;assembly=MoPlus.SolutionBuilder.WpfClient"
                     mc:Ignorable="d">
	<lib:EditControl.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="../../Resources/Theme.xaml" />
			</ResourceDictionary.MergedDictionaries>
			<Style x:Key="PropertyValueInput" BasedOn="{StaticResource LabelInput}" TargetType="{x:Type Label}">
				<Style.Triggers>
					<DataTrigger Binding="{Binding PropertyInstanceViewModel.PropertyValueCustomized, Mode=OneWay}" Value="True">
						<DataTrigger.Setters>
							<Setter Property="Foreground" Value="Black" />
						</DataTrigger.Setters>
					</DataTrigger>
					<DataTrigger Binding="{Binding PropertyInstanceViewModel.PropertyValueValidationMessage, Converter={StaticResource IsNullOrEmptyConverter}, Mode=OneWay}" Value="False">
						<DataTrigger.Setters>
							<Setter Property="Foreground" Value="Red" />
						</DataTrigger.Setters>
					</DataTrigger>
				</Style.Triggers>
			</Style>
			<VM:LabelHelper x:Key="labels" />
		</ResourceDictionary>
	</lib:EditControl.Resources>
	<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Background="{StaticResource ControlBackgroundBrush}">
		<Grid DataContextChanged="Grid_DataContextChanged" Margin="2"
			  MaxWidth="{Binding ActualWidth, RelativeSource={RelativeSource FindAncestor, AncestorType=ScrollViewer}}">
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto"></RowDefinition>
			</Grid.RowDefinitions>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="10"></ColumnDefinition>
				<ColumnDefinition Width="Auto"></ColumnDefinition>
				<ColumnDefinition Width="*"></ColumnDefinition>
				<ColumnDefinition Width="10"></ColumnDefinition>
			</Grid.ColumnDefinitions>
			<Label Grid.Row="0" Grid.Column="1" Style="{DynamicResource PropertyValueInput}" Content="{Binding ModelPropertyNameLabel, Mode=OneWay}" />
			<ComboBox Margin="0" Grid.Row="0" Grid.Column="2" Visibility="{Binding ObjectInstanceListVisiblity}" ToolTip="{Binding PropertyInstanceViewModel.PropertyValueValidationMessage, Mode=OneWay}" ItemsSource="{Binding ObjectInstanceListItems}" DisplayMemberPath="DisplayName" SelectedValuePath="ObjectInstanceID" SelectedValue="{Binding SelectedObjectInstanceID, Mode=TwoWay, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}" Validation.ErrorTemplate="{x:Null}" />
			<ComboBox Margin="0" Grid.Row="0" Grid.Column="2" Visibility="{Binding ValueListVisiblity}" ToolTip="{Binding PropertyInstanceViewModel.PropertyValueValidationMessage, Mode=OneWay}" ItemsSource="{Binding ValueListItems}" DisplayMemberPath="EnumValue" SelectedValuePath="EnumValue" SelectedValue="{Binding PropertyInstanceViewModel.PropertyValue, Mode=TwoWay, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}" Validation.ErrorTemplate="{x:Null}" />
			<TextBox Margin="0" Grid.Row="0" Grid.Column="2" Visibility="{Binding ValueVisibility}" ToolTip="{Binding PropertyInstanceViewModel.PropertyValueValidationMessage, Mode=OneWay}" Text="{Binding PropertyInstanceViewModel.PropertyValue, Mode=TwoWay, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}" MaxLength="255" Validation.ErrorTemplate="{x:Null}" Loaded="TextBox_Loaded"/>
		</Grid>
	</ScrollViewer>
</lib:EditControl>